package com.spic.business.datamanagement.blast.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.spic.business.blast.mapper.BlastDeploymentMapper;
import com.spic.business.datamanagement.blast.domain.BlastDeploymentDirty;
import com.spic.business.datamanagement.blast.mapper.BlastDeploymentDirtyMapper;
import com.spic.business.datamanagement.blast.service.IBlastDeploymentDirtyService;
import com.spic.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 爆破布防Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-11-27
 */
@Service
public class BlastDeploymentDirtyServiceImpl implements IBlastDeploymentDirtyService 
{
    @Autowired
    private BlastDeploymentDirtyMapper blastDeploymentDirtyMapper;
    @Autowired
    private BlastDeploymentMapper blastDeploymentMapper;

    /**
     * 查询爆破布防
     * 
     * @param id 爆破布防主键
     * @return 爆破布防
     */
    @Override
    public BlastDeploymentDirty selectBlastDeploymentDirtyById(String id)
    {
        return blastDeploymentDirtyMapper.selectBlastDeploymentDirtyById(id);
    }

    /**
     * 查询爆破布防列表
     * 
     * @param blastDeploymentDirty 爆破布防
     * @return 爆破布防
     */
    @Override
    public List<BlastDeploymentDirty> selectBlastDeploymentDirtyList(BlastDeploymentDirty blastDeploymentDirty)
    {
        return blastDeploymentDirtyMapper.selectBlastDeploymentDirtyList(blastDeploymentDirty);
    }

    /**
     * 新增爆破布防
     * 
     * @param blastDeploymentDirty 爆破布防
     * @return 结果
     */
    @Override
    public int insertBlastDeploymentDirty(BlastDeploymentDirty blastDeploymentDirty)
    {
        blastDeploymentDirty.setCreateTime(DateUtils.getNowDate());
        return blastDeploymentDirtyMapper.insertBlastDeploymentDirty(blastDeploymentDirty);
    }

    @Override
    public Map<String, Integer> statistics() {
        Integer all = 0, allDirty = 0, incomplete = 0, incorrect = 0;
        all = blastDeploymentMapper.selectCount(new QueryWrapper<>());
        allDirty = blastDeploymentDirtyMapper.selectCount(new QueryWrapper<>());
        Map<String, Integer> map = new HashMap<>();
        map.put("all", all);
        map.put("allDirty", allDirty);
        map.put("incomplete", incomplete);
        map.put("incorrect", allDirty);
        return map;
    }


}
